/* article.css - 文章页样式 */

:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --text-color: #333;
  --light-text: #666;
  --lighter-text: #999;
  --border-color: #eee;
  --bg-color: #fff;
  --light-bg: #f8f9fa;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--light-bg);
  min-height: 100vh;
}

/* 容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 头部导航 */
.site-header {
  background: var(--bg-color);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-list a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 16px;
  transition: var(--transition);
  margin-right: 10px;
}

.nav-links a:hover {
  color: var(--secondary-color);
}

.user-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.search-btn,
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-color);
  transition: var(--transition);
}

.search-btn:hover,
.theme-toggle:hover {
  color: var(--secondary-color);
}

/* 文章容器 */
.article-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  margin: 40px auto;
}

@media (max-width: 992px) {
  .article-container {
    grid-template-columns: 1fr;
  }
}

/* 文章内容区 */
.article-main {
  background: var(--bg-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.article-header {
  padding: 40px 40px 20px;
  border-bottom: 1px solid var(--border-color);
}

.article-category {
  display: inline-block;
  padding: 4px 12px;
  background: var(--secondary-color);
  color: white;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 16px;
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  color: var(--primary-color);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--light-text);
  font-size: 14px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-item i {
  font-size: 16px;
}

/* 文章封面 */
.article-cover {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
}

/* 文章内容样式 */
.article-content {
  padding: 40px;
  font-size: 16px;
  line-height: 1.8;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  margin: 32px 0 16px;
  color: var(--primary-color);
  font-weight: 600;
}

.article-content h2 {
  font-size: 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  font-size: 20px;
}

.article-content h4 {
  font-size: 18px;
}

.article-content p {
  margin-bottom: 20px;
  text-align: justify;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 24px 0;
  box-shadow: var(--shadow);
  display: block;
}

.article-content blockquote {
  border-left: 4px solid var(--secondary-color);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--light-text);
  font-style: italic;
  background: var(--light-bg);
  padding: 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-content code {
  background: var(--light-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  color: var(--accent-color);
}

.article-content pre {
  background: var(--primary-color);
  color: #fff;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.5;
}

.article-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.article-content ul,
.article-content ol {
  margin: 20px 0;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--bg-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.article-content th,
.article-content td {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.article-content th {
  background: var(--light-bg);
  font-weight: 600;
  color: var(--primary-color);
}

.article-content tbody tr:hover {
  background: var(--light-bg);
}

/* 文章标签 */
.article-tags {
  padding: 20px 40px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 4px 12px;
  background: var(--light-bg);
  border-radius: 20px;
  font-size: 12px;
  color: var(--light-text);
  text-decoration: none;
  transition: var(--transition);
}

.tag:hover {
  background: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
}

/* 文章操作栏 */
.article-actions {
  padding: 20px 40px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--light-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-color);
  text-decoration: none;
  font-size: 14px;
}

.action-btn:hover {
  background: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
  transform: translateY(-2px);
}

/* 侧边栏 */
.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-widget {
  background: var(--bg-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.widget-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-title::before {
  content: "";
  width: 4px;
  height: 16px;
  background: var(--secondary-color);
  border-radius: 2px;
}

/* 作者信息 */
.author-info {
  text-align: center;
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 3px solid var(--border-color);
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.author-bio {
  color: var(--light-text);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.author-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

.stat-label {
  font-size: 12px;
  color: var(--light-text);
}

/* 相关文章 */
.related-articles {
  list-style: none;
}

.related-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.related-item:last-child {
  border-bottom: none;
}

.related-item:hover {
  background: var(--light-bg);
  padding-left: 8px;
}

.related-item a {
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
  display: block;
  font-size: 14px;
  line-height: 1.4;
}

.related-item a:hover {
  color: var(--secondary-color);
}

.related-meta {
  font-size: 12px;
  color: var(--light-text);
  margin-top: 4px;
}

/* 目录导航 */
.toc {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-list {
  list-style: none;
}

.toc-item {
  padding: 8px 0;
  border-left: 2px solid transparent;
  padding-left: 12px;
  transition: var(--transition);
}

.toc-item:hover {
  border-left-color: var(--border-color);
}

.toc-item.active {
  border-left-color: var(--secondary-color);
  background: var(--light-bg);
}

.toc-item a {
  color: var(--light-text);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
  display: block;
}

.toc-item.active a,
.toc-item a:hover {
  color: var(--secondary-color);
}

.toc-item.level-2 {
  padding-left: 24px;
  font-size: 13px;
}

.toc-item.level-3 {
  padding-left: 36px;
  font-size: 12px;
}

/* 评论区域 */
.comments-section {
  margin-top: 40px;
  background: var(--bg-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.comment-form {
  margin-bottom: 40px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--primary-color);
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background: var(--bg-color);
  color: var(--text-color);
}

.form-input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

.submit-btn {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: var(--transition);
}

.submit-btn:hover {
  background: #2980b9;
  transform: translateY(-2px);
}

.reset-btn {
  background: var(--light-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 12px 32px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: var(--transition);
}

.reset-btn:hover {
  background: var(--border-color);
}

/* 评论列表 */
.comment-list {
  list-style: none;
}

.comment-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light-text);
  font-weight: 600;
}

.comment-meta {
  display: flex;
  flex-direction: column;
}

.comment-name {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 14px;
}

.comment-time {
  font-size: 12px;
  color: var(--light-text);
}

.comment-actions {
  display: flex;
  gap: 12px;
}

.comment-action {
  background: none;
  border: none;
  color: var(--light-text);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.comment-action:hover {
  color: var(--secondary-color);
}

.comment-content {
  color: var(--text-color);
  line-height: 1.6;
  margin-bottom: 16px;
  font-size: 14px;
}

.comment-reply {
  padding-left: 20px;
  border-left: 2px solid var(--border-color);
  margin-top: 16px;
}
.article-summary-wrapper {
  /* 核心：设置最大宽度，缩小摘要宽度（可根据需求调整） */
  max-width: 800px;
  /* 水平居中显示 */
  margin: 16px auto;
  /* 可选：限制最小宽度，适配小屏幕 */
  min-width: 300px;
}

/* 文章摘要核心样式 */
.article-summary {
  /* 浅灰色背景 */
  background-color: #f0f0f0;
  /* 内边距：保持文字舒适间距 */
  padding: 20px 24px;
  /* 底部突出效果 */
  border-bottom: 3px solid #ccc;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  /* 基础排版 */
  font-size: 16px;
  line-height: 1.8;
  color: #333;
  /* 圆角优化 */
  border-radius: 4px 4px 0 0;
  /* 宽度铺满外层容器（由外层max-width控制） */
  width: 100%;
  box-sizing: border-box;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .article-summary-wrapper {
    /* 移动端放宽宽度，适配屏幕 */
    max-width: 90%;
    min-width: auto;
  }
  .article-summary {
    padding: 16px 20px;
    font-size: 15px;
    border-bottom-width: 2px;
  }
}
.user-actions {
  display: flex;
  align-items: center;
  gap: 8px; /* 与原有按钮间距一致 */
}

.search-form {
  display: flex;
  align-items: center;
  background-color: #f5f5f5; /* 浅灰色背景，适配页面风格 */
  border-radius: 4px; /* 圆角，与原有按钮统一 */
  padding: 0 8px;
  height: 36px; /* 适配原有按钮高度 */
  width: 220px; /* 可根据需求调整宽度 */
  transition: all 0.3s ease;
}

/* 搜索输入框样式 */
.search-input {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #333;
  padding: 0 8px;
  box-sizing: border-box;
}

/* 输入框占位符样式 */
.search-input::placeholder {
  color: #999;
  font-size: 13px;
}

/* 搜索按钮样式（复用原有按钮样式） */
.search-btn {
  border: none;
  outline: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 2px;
  transition: color 0.2s ease;
}

/* 按钮hover效果，与原有交互一致 */
.search-btn:hover {
  color: #0066cc; /* 主色调，适配页面风格 */
}

/* 聚焦时样式优化 */
.search-form:focus-within {
  background-color: #fff;
  box-shadow: 0 0 0 1px #0066cc; /* 聚焦边框，提升体验 */
}

/* 移动端适配 */
@media (max-width: 768px) {
  .search-form {
    width: 160px; /* 移动端缩小宽度 */
    height: 32px;
  }
  .search-input {
    font-size: 13px;
  }
}
